<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    div {
        width: 100px;
        height: 100px;
        background: red;
        position: relative;
        animation-name: divmove;
        animation-duration: 5s;
        animation-timing-function: linear;
        animation-delay: 2s;
        animation-iteration-count: infinite;
        animation-direction: alternate;
        animation-play-state: running;
    }

    @keyframes divmove {
        0% {
            background: red;
            left: 0px;
            top: 0px;
        }

        25% {
            background: yellow;
            left: 200px;
            top: 0px;
        }

        50% {
            background: blue;
            left: 200px;
            top: 200px;
        }

        75% {
            background: green;
            left: 0px;
            top: 200px;
        }

        100% {
            background: red;
            left: 0px;
            top: 0px;
        }
    }

</style>

<body>
    <div></div>
</body>

</html>